<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="内容.Css">
    <link rel="stylesheet" href="css/全部用户信息.css">
    <link rel="stylesheet" href="./iconfont/iconfont.css">

</head>
<script type="text/javascript" src="js/jquery-3.1.1.js"></script>
<script type="text/javascript">
   function deleteUser(id){
     $.get("deleteById.do?uid="+id, function(result){
	  if(result){
	   window.location.href="content.html";
	  }
	 });
   }
   $(document).ready(function(){
    $("input[name='select']").click(function(){
	  if($(this).val()==0){
	   $(".dao").prop("checked",true);
	   $(this).val(1);
	  }else{
	   $(".dao").prop("checked",false);
	   $(this).val(0);
	  }
   });

    $.get("content.do",function(result){
	 $("#content").empty();
	 let str = "";
	 for(let i=0;i<result.length;i++){
	  let user=result[i];
	  str +="<tr>";
	  str +='<td><input type="checkbox" class="sab"></td>';
	  str +='<td><span>'+user.uid+'</span></td>';
	  str +='<td><span>'+user.username+'</span></td>';
	  str +='<td><span>'+user.password+'</span></td>';
	  str +='<td><span>'+user.uname+'</span></td>';
	  str +='<td><span>'+user.urole+'</span></td>';
	  str +='<td><span>'+user.lasttime+'</span></td>';
	  str += '<td><img src="'+user.uimage+'"></td>';
      str +='<a title="编辑" href="updataUserPage.do?uid='+user.uid+'" edit-a">';
	  str +='<i class="iconfont icon-bianjixiugai max"></i>';
	  str +='</a>';
	  str +='<a title="删除" href="javascript:deleteUser('+user.uid+')" class="delt">';
	  str +='<i class="iconfont icon-shanchu1 max"></i>';
	  str +='</a>';
	  str +="</tr>";
	 }
	 $("#userList").append(str);
	});
  });
  function searchData(){
   let username = $("#search").val();
   if(username.length>0){
    $.get("selectUserWithUsername.do?username="+username,function(result){
	 $("#userList").empty();
	 let str = "";
	 for(let i=0;i<result.length;i++){
	  let user=result[i];
	  str +="<tr>";
	  str +='<td><input type="checkbox" class="sab"></td>';
	  str +='<td><span>'+user.uid+'</span></td>';
	  str +='<td><span>'+user.username+'</span></td>';
	  str +='<td><span>'+user.password+'</span></td>';
	  str +='<td><span>'+user.uname+'</span></td>';
	  str +='<td><span>'+user.urole+'</span></td>';
	  str +='<td><span>'+user.lasttime+'</span></td>';
	  str += '<td><img src="'+user.uimage+'"></td>';
      str +='<a title="编辑" href="updataUserPage.do?uid='+user.uid+'" edit-a">';
	  str +='<i class="iconfont icon-bianjixiugai max"></i>';
	  str +='</a>';
	  str +='<a title="删除" href="javascript:deleteUser('+user.uid+')" class="delt">';
	  str +='<i class="iconfont icon-shanchu1 max"></i>';
	  str +='</a>';
	  str +="</tr>";
	 }
	 $("#userList").append(str);
	});
   }else{
    alert("请输入要检索的信息");
   }
  }
  
</script>
</head>
<body>
        <h2>全部用户信息</h2>
        <hr>
    
    <div class="container">

        <form action="addUser.do" method="post" id="form" enctype="multipart/form-data" class="parent">
            <input type="text"class="search" placeholder="请输入内容">
    
            <input type="button" value="查询">
            <input type="reset" value="重置">
        </form>
    
    </div>
    
 <div class="border clearfix">
    <span>
    <a href="用户添加.html" title="添加用户" class="btn btn-warning Order_form"><i class="icon-plus"></i>添加用户</a>
    </span>
    <span class="r_f">共:<b id="count">34</b>个用户</span>
   </div>
   <div >
    <div>
     <label>显示条数：
      <select >
       <option value="10">10</option>
       <option value="25">25</option>
       <option value="50">50</option>
       <option value="100">100</option>
      </select>
     </label>
    </div>
    <div >
        <table >
            <thead>
                <tr role="row">
                    <th><span>目录</span></th>
                    <th><span>用户编号</span></th>
                    <th><span>用户名</span></th>
                    <th><span>密码</span></th>
                    <th><span>昵称</span></th>
                    <th><span>角色名</span></th>
                    <th><span>最后登录时间</span></th>
                    <th><span>头像</span></th>
                    <th><span>备注</span></th>
                </tr>
            </thead>
           
            <tbody id="content">
                <tr>
                    <td><input type="checkbox" class="dao"></td>
                    <td><span>101</span></td>
                    <td><span>zhangsan</span></td>
                    <td><span>123</span></td>
                    <td><span>张三</span></td>
                    <td><span>管理员</span></td>
                    <td><span>2022-12-26 20:00:00</span></td>
                    <td><img src="https://tse3-mm.cn.bing.net/th/id/OIP-C.ev2x286TZ7G1eOQT1oU_TwAAAA?pid=ImgDet&rs=1"></td>
                    <td>
                        <a title="编辑" href="javascript:;" class="edit-a">
                            <i class="iconfont icon-bianjixiugai max">
                            </i>
                           </a>
                            <a title="删除" href="javascript:;" class="delt">
                            <i class="iconfont icon-shanchu1 max">
                            </i>
                         </a>
                         </td>
                </tr>
                <tr>
                    <td><input type="checkbox" class="dao"></td>
                    <td><span>101</span></td>
                    <td><span>zhangsan</span></td>
                    <td><span>123</span></td>
                    <td><span>张三</span></td>
                    <td><span>管理员</span></td>
                    <td><span>2022-12-26 20:00:00</span></td>
                    <td><img src="https://tse3-mm.cn.bing.net/th/id/OIP-C.ev2x286TZ7G1eOQT1oU_TwAAAA?pid=ImgDet&rs=1"></td>
                    <td>
                     <a title="编辑" href="javascript:;" class="edit-a">
                      <i class="iconfont icon-bianjixiugai max"></i>
                     </a>
                      <a title="删除" href="javascript:;" class="delt">
                      <i class="iconfont icon-shanchu1 max"></i>
                     </a>
                    </td>
                   </tr>
            </tbody>   
        </table>
    </div>
   
</body>
</html>